package com.atguigu.gmall.order.service;

import com.atguigu.gmall.model.enums.ProcessStatus;
import com.atguigu.gmall.model.order.OrderInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author tongatong
 * @name OrderService
 * @description
 * @date 2021/9/25
 * @time 11:22
 */
public interface OrderService extends IService<OrderInfo> {
    //保存订单
    Long saveOrderInfo(OrderInfo orderInfo);
    //获取并生成流水号
    String getTradeNo(String userId);
    //比较流水号
    boolean checkTradeCode(String userId, String tradeCodeNo);
    //删除流水号
    void deleteTradeNo(String userId);
    //从第三方仓库，验证库存
    boolean checkStock(Long skuId, Integer skuNum);
    //我的订单
    IPage<OrderInfo> getPage(Page<OrderInfo> pageParam, String userId);
    //取消订单
    void execExpiredOrder(Long orderId);
    //修改订单状态
    void updateOrderStatus(Long orderId, ProcessStatus processStatus);
    //根据订单Id 查询订单信息
    OrderInfo getOrderInfo(Long orderId);
    //发送消息给库存！
    void sendOrderStatus(Long orderId);
    //将orderInfo变为map集合
    Map<String, Object> initWareOrder(OrderInfo orderInfo);
    //拆单操作
    List<OrderInfo> orderSplit(long orderId, String wareSkuMap);
    //更新过期订单
    void execExpiredOrder(Long orderId,String flag);

    /**
     * 更新评价状态
     * @param orderId
     */
    void updateCommnetStatus(Long orderId);

}
